<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改学生</title>
    <link rel="stylesheet" href="../css/table.css">
</head>

<body>
    <h1>修改【{{student.studentName}}】的学生信息</h1>
    <form>
        <table>
            <tr>
                <td>学生姓名：</td>
                <td><input type="text" required /></td>
            </tr>

            <tr>
                <td>学生年龄：</td>
                <td><input type="text" required /></td>
            </tr>

            <tr>
                <td>入学时间：</td>
                <td> <input type="text" required /></td>
            </tr>

            <tr>
                <td>学生所在班级：</td>
                <td><input type="text" required /></td>
            </tr>

            <tr>
                <td colspan="2">
                    <input type="submit" value="保存" />
                    <input type="button" value="取消" onclick="cancel()" />
                </td>
            </tr>
        </table>


    </form>

    <!-- 导入 js 文件 -->
    <script src="../js/update.js"></script>
    <script>
        // 取消函数
        function cancel() {
            // 重定向返回首页
            location.href = "/student";
        }

        // 因为后面的时间会被遮挡，所以用 js 赋值
        inputs[0].value = `{{ student.studentName}}`;
        inputs[1].value = `{{ student.studentAge}}`;
        inputs[2].value = `{{ student.enrollmentTime}}`;
        inputs[3].value = `{{ student.classRoom}}`;
    </script>
</body>

</html>